import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_ohos/app/utils/log_utils.dart';
import 'package:provider/provider.dart';

import 'five_provider.dart';

class FivePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (BuildContext context) => FiveProvider(),
      builder: (context, child) => _buildPage(context),
    );
  }

  Widget _buildPage(BuildContext context) {
    final provider = context.read<FiveProvider>();
    final state = provider.state;

    return Scaffold(
      appBar: AppBar(title: Text('FivePage'),),
      body: Container(
        margin: EdgeInsets.only(top: 40),
        height: 44,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Flexible(
              child: Container(
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(4),
                    color: Colors.redAccent),
                margin: EdgeInsets.fromLTRB(12, 6, 12, 6),
                padding: const EdgeInsets.fromLTRB(8, 6, 8, 6),
                // width: Global.screenWidth - 70,
                child: TextFormField(
                  decoration: InputDecoration(
                    labelText: '输入框标签',
                  ),
                  validator: (value) {
                    // 验证输入内容的逻辑
                    LogUtils.d("内容validator：${value}");
                  },
                  onSaved: (value) {
                    // 保存输入内容的逻辑
                  },
                ),
                // child: TextField(
                //   decoration: InputDecoration.collapsed(
                //       hintText: "请输入",
                //       hintStyle: TextStyle(
                //           color: Colors.white,
                //           fontSize: 14,
                //           fontWeight: FontWeight.w400)),
                //   onChanged: (v) {
                //     LogUtils.d("内容onChanged：${v}");
                //     // provider.changeTextAction(v);
                //   },
                // ),
              ),
            ),
          ],
        ),
      ),
    );
  }

}